/*
 ------------------------------------------------------------------------------
 Copyright (C) 2006-2007 Team Blur.

 This file is part of the Quantum Engine source code.

 The Quantum Engine source code is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or (at your
 option) any later version.

 The Quantum Engine source code is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 more details.

 You should have received a copy of the GNU General Public License along with
 the Quantum Engine source code; if not, write to the Free Software Foundation, Inc.,
 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 ------------------------------------------------------------------------------
*/


// shared.h -- included first by ALL program modules


#ifndef __SHARED_H__
#define __SHARED_H__

#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include <ctype.h>

/*
 ==============================================================================

 WIN32 DEFINES

 ==============================================================================
*/

#ifdef _WIN32

#define BUILD_STRING			"Win32-x86"
#define CPU_STRING				"x86"

#define PATH_SEPARATOR_STRING	"\\"
#define PATH_SEPARATOR_CHAR		'\\'

#define LINE_SEPARATOR			"\r\n"

//#define INLINE					__forceinline
#define 	INLINE				inline

#define vsnprintf				_vsnprintf

#endif

/*
 ==============================================================================

 LINUX DEFINES

 ==============================================================================
*/

#ifdef __linux__

#if defined __i386__
#define BUILD_STRING			"Linux-x86"
#define CPU_STRING				"x86"
#elif defined __ppc__
#define BUILD_STRING			"Linux-PPC"
#define CPU_STRING				"ppc"
#endif

#define PATH_SEPARATOR_STRING	"/"
#define PATH_SEPARATOR_CHAR		'/'

#define LINE_SEPARATOR			"\n"

#define INLINE					inline

#endif

/*
 ==============================================================================

 MACOSX DEFINES

 ==============================================================================
*/

#ifdef MACOS_X

#if defined __ppc__
#define BUILD_STRING			"MacOSX-PPC"
#define CPU_STRING				"ppc"
#elif defined __i386__
#define BUILD_STRING			"MacOSX-x86"
#define CPU_STRING				"x86"
#endif

#define PATH_SEPARATOR_STRING	"/"
#define PATH_SEPARATOR_CHAR		'/'

#define LINE_SEPARATOR			"\n"

#define INLINE					inline

#endif

/*
 ==============================================================================

 SHARED TYPES AND DEFINES

 ==============================================================================
*/

typedef unsigned char 			byte;
typedef unsigned short			word;
typedef unsigned long			dword;

typedef unsigned short			ushort;
typedef unsigned int			uint;
typedef unsigned long			ulong;

#ifdef __cplusplus
//#define false					0
//#define true					1

//#define bool					int

#else

typedef enum {false, true}		bool;

#endif

#ifndef NULL
#define NULL					((void *)0)
#endif

#ifndef BIT
#define BIT(num)				(1 << (num))
#endif

#ifndef ALIGN
#define ALIGN(bytes, size)		(((bytes) + (size) - 1) & ~((size) - 1))
#endif

#define MAX_STRING_LENGTH		1024		// Max length of a string
#define	MAX_OSPATH					256			// Max length of a file system path

/*
 ==============================================================================

 SHARED HEADERS

 ==============================================================================
*/

#include "m_math.h"
#include "m_vector.h"
#include "m_angles.h"
#include "m_quat.h"
#include "m_matrix.h"
#include "m_jointMatrix.h"
#include "m_bounds.h"
#include "m_plane.h"

#include "Exception.h"
#include "ByteBuffer.h"
#include "VariableList.h"
#include "Class.h"
#include "util.h"
#include "color.h"
#include "swap.h"
#include "string.h"

#endif	// ___SHARED_H__
